#include <cstdlib>
#include <ctime>

#include "CRandomGenerator.h"

CRandomGenerator::CRandomGenerator(unsigned int const ss)
    : seed(ss)
{
    if(!this->seed)
        this->seed = std::time(0);

    std::srand(this->seed);
}

unsigned int CRandomGenerator::GetSeed(void) const
{
    return this->seed;
}

void CRandomGenerator::SetSeed(unsigned int const ss)
{
    this->seed = ss;
    if(!this->seed)
        this->seed = std::time(0);

    std::srand(this->seed);
}

double CRandomGenerator::GetRandomNumber(void) const
{
    return double(std::rand())/double(RAND_MAX);
}
